export default () => {
	//
	const phoneDese = (phone : string) => {
		if (!phone) return "";
		return phone.replace(/(\d{3})\d{4}(\d{3})/, "$1****$2");
	};

	//
	const idcardDese = (idcard : string) => {
		if (!idcard) return "";
		return idcard.replace(/(\d{6})\d{8}(\w{4})/, "$1****$2");
	};

	//
	const nameDese = (name : string) => {
		if (!name) return "";
		if (name.length > 1) return name.substring(0, 1) + "*" + name.substring(name.length - 1);

		return name;
	};

	return { phoneDese, idcardDese, nameDese };
};